package org.nobody.mallb2c.mallware.service;

import com.baomidou.mybatisplus.extension.service.IService;
import org.nobody.common.to.mq.OrderTo;
import org.nobody.common.to.mq.StockLockedTo;
import org.nobody.common.utils.PageUtils;
import org.nobody.mallb2c.mallware.entity.WareSkuEntity;
import org.nobody.mallb2c.mallware.vo.LockStockResult;
import org.nobody.mallb2c.mallware.vo.SkuHasStockVo;
import org.nobody.mallb2c.mallware.vo.WareSkuLockVo;

import java.util.List;
import java.util.Map;

/**
 * 商品库存
 *
 * @author fancier
 * @email fancier2093@gmail.com
 * @date 2020-07-30 15:47:39
 */
public interface WareSkuService extends IService<WareSkuEntity> {

  PageUtils queryPage(Map<String, Object> params);

  void addStock(Long skuId, Long wareId, Integer skuNum);

  List<SkuHasStockVo> getSkusHasStock(List<Long> skuIds);

  /**
   * 为指定的订单锁定库存
   * @param vo
   * @return
   */
  Boolean orderLockStock(WareSkuLockVo vo);

  void unlockStock(StockLockedTo to);

  void unlockStock(OrderTo orderTo);
}

